package com.zuoban.storage.service.impl;

import com.qiniu.storage.Configuration;
import com.qiniu.storage.Region;
import com.qiniu.storage.UploadManager;
import com.qiniu.util.Auth;
import com.zuoban.storage.properties.StorageProperties;
import com.zuoban.storage.service.StorageService;

import java.io.InputStream;

/**
 * @BelongsProject: zuoban-boot
 * @BelongsPackage: com.zuoban.storage.service.impl
 * @Author: zxy
 * @CreateTime: 2022-10-10
 * @Description: ...
 */
public class QiniuStorageServiceImpl implements StorageService {
    private final StorageProperties storageProperties;
    private final UploadManager uploadManager;
    private final String token;

    public QiniuStorageServiceImpl(StorageProperties storageProperties) {
        this.storageProperties = storageProperties;
        this.uploadManager = new UploadManager(new Configuration(Region.autoRegion()));
        this.token = Auth.create(storageProperties.getQiniu().getAccessKey(), storageProperties.getQiniu().getSecretKey()).
                uploadToken(storageProperties.getQiniu().getBucketName());
    }

    @Override
    public String upload(InputStream inputStream, String path) {
        return null;
    }
}
